// job.go
//系统的计划任务
//时间为:分钟/小时/周/月
package cronjob

import (
	"time"
)

//分钟timer
var minTimer *time.Ticker
var minDuration = 1 * time.Minute

//小时timer
var hourTimer *time.Ticker
var hourDuration = 1 * time.Hour

//天timer
var dayTimer *time.Ticker
var dayDuration = 24 * time.Hour

//月timer
var monTimer *time.Ticker
var monDuration = 30 * 24 * time.Hour

func init() {
	minTimer = time.NewTicker(minDuration)
	hourTimer = time.NewTicker(hourDuration)
	dayTimer = time.NewTicker(dayDuration)
	monTimer = time.NewTicker(monDuration)
}

func Run() {
	for {
		select {
		case <-minTimer.C:
			go minJob()
		case <-hourTimer.C:
			go hourJob()
		case <-dayTimer.C:
			go dayJob()
		case <-monTimer.C:
			go monthJob()
		}
	}
}

//分钟的task
//检查access_token
func minJob() {
}

//小时的task
func hourJob() {
	return
}

//天task
//结算物业费
func dayJob() {
}

//月task
func monthJob() {
	return
}
